﻿using OnHook.Business.Vo.UserInfo;

namespace OnHook.Business.IServices.Common
{
    /// <summary>
    /// Jwt服务
    /// </summary>
    public interface IJwtService
    {
        /// <summary>
        /// /生成token
        /// </summary>
        /// <returns></returns>
        string Generate(LoginUserVo userInfo);
        /// <summary>
        /// 解析JWT
        /// </summary>
        /// <param name="token"></param>
        /// <param name="errorMsg"></param>
        /// <returns></returns>
        LoginUserVo GetLoginUserVoByToken(string token, out string errorMsg);
        /// <summary>
        /// 获取当前登录人
        /// </summary>
        /// <returns></returns>
        LoginUserVo? GetCurrentUser();

        /// <summary>
        /// 校验解析token
        /// </summary>
        /// <returns></returns>
        bool ValidateJwtToken(string token, out string msg);
    }
}
